<?php

class Bootstrap {
 
	function __construct() {
  
  $url = array();
		
  if(empty($_GET['url'])){
    $url[0]='index';		  
  } else{

    $url = $_GET['url'];
    $url = rtrim($url, '/');
    $url = explode('/', $url);
   
  }
  
  
  $file = 'controllers/' . $url[0] . '.php';
		if (file_exists($file)) {
			require $file;
		} else {
			require 'controllers/error.php';
			$controller = new Error();
			return false;
		}
		
  
		$controller = new $url[0];
		
			if (isset($url[1])) {print_r($url);
				$controller->{$url[0]}($url[1]);
			}
 }
}